package com.sky.service.impl;

import com.sky.context.BaseContext;
import com.sky.entity.UserReadingData;
import com.sky.repository.UserReadingDataRepository;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserReadingDataServiceImpl {
    @Autowired
    private UserReadingDataRepository userReadingDataRepository;

    /**
     * 获取用户阅读数据
     * @return
     */
    public UserReadingData getUserReadingData() {
        Integer id = BaseContext.getCurrentId();
        return userReadingDataRepository.findByuId(id);
    }

    /**
     * 根据用户id获取阅读数据
     * @param id
     * @return
     */
    public UserReadingData getByUId(int id) {
        return userReadingDataRepository.findByuId(id);
    }
}
